package functionalTest;

import static org.junit.Assert.assertEquals;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import domain.DeliveryType;
import domain.Envelope;
import domain.EnvelopeType;
import domain.Mission;
import domain.MissionStatus;
import domain.POS;

public class MissionUnitTest {
	Mission mission = null;
	
	@Before
	public void setUp() throws Exception {
		
		POS pos = new POS();
			pos.setName("BTNC heuartead qr");
			pos.setLatitute(13.711428);
			pos.setLongtitute(100.594103);
			
		POS pos2 = new POS();
			pos2.setName("The Mall Ramkhamhaeng 3");
			pos2.setLatitute(13.752729);
			pos2.setLongtitute(100.609644);
			
		Envelope e1 = new Envelope();
			e1.setEnvelopeType(EnvelopeType.delivered);
			e1.setEnvelopId("D001");
			e1.setNoOfProduct(10);
			
		mission = new Mission();
			mission.setFromPOS(pos);
			mission.setToPOS(pos2);
			mission.setPriority(1);
			mission.setDevType(DeliveryType.refill);
			mission.setStatus(MissionStatus.complete);
			mission.addEnvelopes(e1);
			
	}

	@After
	public void tearDown() throws Exception {
		mission = null;
	}

	@Test
	public void testUpdateCompelteStatus() {
		mission.updateCompelteStatus();
		assertEquals(MissionStatus.complete, mission.getStatus());
	}
}
